package com.southpark.demo.control.responders.data
{
	import com.southpark.demo.control.events.data.GetDataEvent;
	import com.southpark.demo.control.events.user.UserLoginEvent;
	import com.southpark.demo.control.responders.BaseResponder;
	import com.southpark.framework.control.responders.IResponder;
	import com.southpark.framework.control.responders.ResponderFactory;
	

	public class SetDataResponder extends BaseResponder
	{
		public function SetDataResponder(responder:IResponder)
		{
			super(responder);
		}
		
		override public function onSuccess(result:Object):void
		{
			var responder:IResponder = ResponderFactory.createResponder(onUserLoginSuccess,onFault);
			var e:UserLoginEvent = new UserLoginEvent(UserLoginEvent.USER_LOGIN_EVENT,responder);
			
			e.userName = model.user.userName;
			e.password = "password";
			
			e.dispatch();
		}
		
		private function onUserLoginSuccess(result:Object):void
		{
			var responder:IResponder = ResponderFactory.createResponder(onGetDataSuccess,onFault);
			var e:GetDataEvent = new GetDataEvent(GetDataEvent.GET_DATA_1_EVENT,responder);
			e.dispatch();
		}
		
		private function onGetDataSuccess(result:Object):void
		{
			super.onSuccess(result);
		}
		
		
	}
}